import { createApp } from 'vue'
import { createPinia } from 'pinia'
import piniaPluginPersist from 'pinia-plugin-persist'

import App from './App.vue'
import SvgIcon from '@/common/svg-icon/SvgIcon.vue'

// 树状图
import vue3TreeOrg from 'vue3-tree-org'
import 'vue3-tree-org/lib/vue3-tree-org.css'

import router from './router'
import './permission'

import 'virtual:svg-icons-register'
import 'element-plus/theme-chalk/dark/css-vars.css'
import 'element-plus/dist/index.css'
import './assets/css/main.css'
import './assets/css/magic-element-plus.less'

import * as ElementPlusIconsVue from '@element-plus/icons-vue'

const app = createApp(App)
// 注入element字体图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.component('SvgIcon', SvgIcon)
const store = createPinia()
store.use(piniaPluginPersist)
app.use(store)
app.use(router)
app.use(vue3TreeOrg)

app.mount('#app')
